home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5381 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  839 b 

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: recursion@aol.com (Recursion)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: for loop question
  5. Date: 4 Feb 1996 01:49:49 -0500
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4f1kud$9rk@newsbf02.news.aol.com>
  9. References: <4emqf8$470@opal.southwind.net>
  10. Reply-To: recursion@aol.com (Recursion)
  11. NNTP-Posting-Host: newsbf02.mail.aol.com
  12.  
  13. The loop is never entered when you set the value equal to 0.  You have
  14. specifed the loop check value to be performed while equal to 10 by using
  15. the ==.  The program works when the value is less than 10.  If you were to
  16. set use 
  17.  
  18. int i;
  19. for (i=10;i==10;i++) the program would enter the loop only one time and
  20. would print out your data.
  21.  
  22. int i;
  23. for(i=0;i--10;i++) will never execute because i will never equal 10.
  24.